using System ;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Server;
using System.Runtime.InteropServices;
using System.IO;
using System.Data.SqlTypes;

namespace moDb_prototype
{   
    [DataObject("People")] 
    public partial class Person 
    {      

        private int id = 1;

        public int ID
        {
            get { return id = 1; }
            set { id = value; }
        }

        private int age;

        public int Age
        {
            get { return age; }
            set { age = value; }
        }

        private string name;
        public string Name
        {
            get { return name; }
            set { name = value; }
        }

        private DateTime dateOfBirth;

        public DateTime DateOfBirth
        {
            get { return dateOfBirth; }
            set { dateOfBirth = value; }
        }
	
        public Person()
        {
        }
    }
}



//using System;
//using System.Collections.Generic;
//using System.Text;
//using Microsoft.SqlServer.Server;
//using System.Runtime.InteropServices;
//using System.IO;
//using System.Data.SqlTypes;

//namespace moDb_prototype
//{
//    [Serializable]
//    [SqlUserDefinedType(Format.Native)]    
//    [StructLayout(LayoutKind.Sequential)]
//    public class Person : INullable ,IManagedRecord 
//    {      

//        private int id = 1;

//        public int ID
//        {
//            get { return id = 1; }
//            set { id = value; }
//        }

//        private int age;

//        public int Age
//        {
//            get { return age; }
//            set { age = value; }
//        }
	
//        public Person()
//        {
//        }

//        public static Person Parse(SqlString s)
//        {            
//            return ManagedRecord<Person>.Parse(s);
//        }

//        public override string ToString()
//        {
//            //Is there a way to avoid instanciating a new object evertime?
//            //Maybe a static cache on ManagedRecord<Person> that checks if it exists first?
//            return new ManagedRecord<Person>(this).ToString(); 
//        }

//        public static Person Null
//        {
//            get
//            {
//                return ManagedRecord<Person>.Null;
//            }
//        }

//        public void setNull(bool value)
//        {
//            IsNull = value;
//        }

//        #region INullable Members
//        private bool isNull;

//        public bool IsNull
//        {
//            get { return isNull; }
//            set { isNull = value; }
//        }

//        #endregion
//    }
//}
